﻿using NoteSystem.Utils;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;

namespace NoteSystem
{
    public partial class Master : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //获取session 取到头像和用户名
            if (Session["User"]!=null)
            {
                DataRow userRow = (DataRow)Session["User"];
                Image1.ImageUrl=userRow["img_url"].ToString();
                lblAccount.Text=userRow["account"].ToString();
                int manager = Convert.ToInt32(userRow["manager"]);
                if(manager==0)
                {
                    lbtnUserManage.Visible=false;
                    liUserManager.Visible=false;
                }
            }

        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //清cookie
            HttpCookie cookie = new HttpCookie("User");
            cookie.Expires = DateTime.Now.AddMonths(-1);
            Response.Cookies.Add(cookie);
            //清session
            Session.Clear();
            Response.Redirect("Login.aspx");
        }
    }
}